export default function WaterMark(content, height, width, rotation, color, size, opacity) {
  // 判断水印是否存在，如果存在，那么不执行
  if (document.getElementById('react-watermark') !== null) {
    return;
  }
  let Line = parseInt(document.body.clientWidth / width); // 一行显示几列
  let StrLine = '';
  for (let i = 0; i < Line; i++) {
    StrLine +=
      '<span style="display: inline-block; line-height:' +
      height +
      'px; width:' +
      width +
      'px; text-align: center; transform:rotate(' +
      rotation +
      'deg); color:' +
      color +
      '; font-size:' +
      size +
      'px; opacity:' +
      opacity +
      ';">' +
      content +
      '</span>';
  }
  let DivLine = document.createElement('div');
  DivLine.innerHTML = StrLine;

  let Column = parseInt(document.body.clientHeight / height); // 一列显示几行
  let StrColumn = '';
  for (let i = 0; i < Column; i++) {
    StrColumn +=
      '<div style="white-space: nowrap;">' + DivLine.innerHTML + '</div>';
  }
  let DivLayer = document.createElement('div');
  DivLayer.innerHTML = StrColumn;
  DivLayer.id = 'react-watermark'; // 给水印盒子添加类名
  DivLayer.style.position = 'fixed';
  DivLayer.style.top = '0px'; // 整体水印距离顶部距离
  DivLayer.style.zIndex = '99999'; // 水印页面层级
  DivLayer.style.pointerEvents = 'none';

  document.body.appendChild(DivLayer); // 到页面中
};